Summarization API Documentation
Text Summarization Endpoint
- Method: POST
- Path:
https://api.kadal.ai/summarization/api/v1/text - Summary: Summarizes input text with configurable style and format.
Description
This endpoint generates a concise summary of the provided text. The summary can be tailored by choosing the language style (Formal, Casual, Normal), the output format (Paragraph or Key Points), and the AI model (gpt-4o or gpt-4o-mini) to balance quality and performance.
Request
- Content-Type: application/x-www-form-urlencoded
Payload
| Parameter | Description | Data Type | Allowed Values | Required |
|---|---|---|---|---|
| source_text | Input text to be summarized | String | Yes | |
| language_style | Tone/style of the summary | String | Formal, Casual, Normal | Yes |
| summary_format | Structure of the summary output | String | Paragraph, Key Points | Yes |
| model | AI model used for summarization | String | gpt-4o, gpt-4o-mini | Yes |
Response
{
"status_code": 200,
"message": "Success: Summarization generated successfully.",
"summary": "Summarized text here"
}
Usage
import requests
# Define the API endpoint and the payload
url = "https://api.kadal.ai/summarization/api/v1/text"
token = "your_token_here"
headers = {
"Authorization": f"Bearer {token}"
}
data = {
"source_text": "Your source text will be given as input.",
"language_style": "Formal",
"summary_format": "Paragraph",
"model": "gpt-4o-mini"
}
# Make the POST request
response = requests.post(url, headers=headers, data=data)
# Print the response
if response.status_code == 200:
print("Response Data:", response.json())
else:
print("Failed to call the API. Status Code:", response.status_code)
print("Response Text:", response.text)
File Summarization Endpoint
- Method: POST
- Path:
https://api.kadal.ai/summarization/api/v1/file - Summary: Summarizes input file with configurable style and format.
Description
This endpoint generates a concise summary of the provided file. The summary can be tailored by choosing the language style (Formal, Casual, Normal), the output format (Paragraph or Key Points), and the AI model (gpt-4o or gpt-4o-mini) to balance quality and performance.
Request
- Content-Type: multipart/form-data
Payload
| Parameter | Description | Data Type | Allowed values | Required |
|---|---|---|---|---|
| file | File to be summarized | Txt, PDF, or Docx (Max size: 20 MB) | Yes | |
| language_style | Tone/style of the summary | String | Formal, Casual, Normal | Yes |
| summary_format | Structure of the summary output | String | Paragraph, Key Points | Yes |
| model | AI model used for summarization | String | gpt-4o, gpt-4o-mini | Yes |
Response
{
"status_code": 200,
"message": "Success: Summarization generated successfully.",
"summary": "Summarized text here"
}
Usage
import requests
# Define the API endpoint and the payload
url = "https://api.kadal.ai/summarization/api/v1/file"
token = "your_token_here"
headers = {
"Authorization": f"Bearer {token}"
}
data = {
"language_style": "Formal",
"summary_format": "Key Points",
"model": "gpt-4o-mini"
}
# Make the POST request
response = requests.post(url, headers=headers, data=data, files={"file": open("your_file_path", "rb")})
# Print the response
if response.status_code == 200:
print("Response Data:", response.json())
else:
print("Failed to call the API. Status Code:", response.status_code)
print("Response Text:", response.text)